﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

using Twilio.TwilML.BaseTypes;

namespace Twilio.TwilML
{
    public class Number : DialNoun
    {
        private string _SendDigits;
        [XmlAttribute("sendDigits"), DefaultValue(null)]
        public string SendDigits
        {
            get { return _SendDigits; }
            set
            {
                foreach (char c in value)
                    if (!char.IsDigit(c) && c != '#' && c != '*' && c != 'w')
                        throw new ArgumentOutOfRangeException("SendDigits", "SendDigits must contain only digits, the '#', '*' or 'w' character.");

                _SendDigits = value;
            }
        }

        [XmlAttribute("url"), DefaultValue(null)]
        public string Url { get; set; }

        [XmlText]
        public string Value { get; set; }

        public Number() { }
        public Number(string number)
        {
            Value = number;
        }
    }
}
